package com.jn.glide.entity;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

import java.util.List;

public class AvatarEntity implements Parcelable {

    private int code;
    private List<ResultDTO> result;
    private String msg;

    protected AvatarEntity(Parcel in) {
        code = in.readInt();
        result = in.createTypedArrayList(ResultDTO.CREATOR);
        msg = in.readString();
    }

    public static final Creator<AvatarEntity> CREATOR = new Creator<AvatarEntity>() {
        @Override
        public AvatarEntity createFromParcel(Parcel in) {
            return new AvatarEntity(in);
        }

        @Override
        public AvatarEntity[] newArray(int size) {
            return new AvatarEntity[size];
        }
    };

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public List<ResultDTO> getResult() {
        return result;
    }

    public void setResult(List<ResultDTO> result) {
        this.result = result;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeInt(code);
        dest.writeTypedList(result);
        dest.writeString(msg);
    }

    public static class ResultDTO implements Parcelable {
        private int id;
        private String name;
        private int num;
        private int sort_order;
        private String icon;
        private String status;
        private List<ListDTO> list;
        private String type;

        protected ResultDTO(Parcel in) {
            id = in.readInt();
            name = in.readString();
            num = in.readInt();
            sort_order = in.readInt();
            icon = in.readString();
            status = in.readString();
            list = in.createTypedArrayList(ListDTO.CREATOR);
            type = in.readString();
        }

        public static final Creator<ResultDTO> CREATOR = new Creator<ResultDTO>() {
            @Override
            public ResultDTO createFromParcel(Parcel in) {
                return new ResultDTO(in);
            }

            @Override
            public ResultDTO[] newArray(int size) {
                return new ResultDTO[size];
            }
        };

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getNum() {
            return num;
        }

        public void setNum(int num) {
            this.num = num;
        }

        public int getSort_order() {
            return sort_order;
        }

        public void setSort_order(int sort_order) {
            this.sort_order = sort_order;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public List<ListDTO> getList() {
            return list;
        }

        public void setList(List<ListDTO> list) {
            this.list = list;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(@NonNull Parcel dest, int flags) {
            dest.writeInt(id);
            dest.writeString(name);
            dest.writeInt(num);
            dest.writeInt(sort_order);
            dest.writeString(icon);
            dest.writeString(status);
            dest.writeTypedList(list);
            dest.writeString(type);
        }

        public static class ListDTO implements Parcelable {
            private int id;
            private String name;
            private String icon;
            private int sort_order;
            private String status;

            protected ListDTO(Parcel in) {
                id = in.readInt();
                name = in.readString();
                icon = in.readString();
                sort_order = in.readInt();
                status = in.readString();
            }

            public static final Creator<ListDTO> CREATOR = new Creator<ListDTO>() {
                @Override
                public ListDTO createFromParcel(Parcel in) {
                    return new ListDTO(in);
                }

                @Override
                public ListDTO[] newArray(int size) {
                    return new ListDTO[size];
                }
            };

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getIcon() {
                return icon;
            }

            public void setIcon(String icon) {
                this.icon = icon;
            }

            public int getSort_order() {
                return sort_order;
            }

            public void setSort_order(int sort_order) {
                this.sort_order = sort_order;
            }

            public String getStatus() {
                return status;
            }

            public void setStatus(String status) {
                this.status = status;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(@NonNull Parcel dest, int flags) {
                dest.writeInt(id);
                dest.writeString(name);
                dest.writeString(icon);
                dest.writeInt(sort_order);
                dest.writeString(status);
            }
        }
    }
}
